let judgeUtil = {};
// 判断是否已授权
judgeUtil.doJudgeLogin = function (vm) {
	// console.log(vm);
	// #ifdef H5
	// 微信公众号
	if (vm.$wechat && vm.$wechat.isWechat()) {
		console.log('vm.hasLogin: ', vm.hasLogin);
		if (!vm.hasLogin) {
			let {
				state,
				appId,
				redirect_uri
			} = vm.$json('wxPublic');
			let encodeIndexUrl = encodeURIComponent(redirect_uri);
			location.href =
				`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${encodeIndexUrl}&response_type=code&scope=snsapi_userinfo&state=${state}#wechat_redirect`;
		}
	}
	// #endif
}

export default judgeUtil;